#include <vector>

using namespace std;

class Solution
{
public:
    int removeDuplicates(vector<int> &nums)
    {
        auto slow = nums.begin();
        auto fast = nums.begin();
        while (fast != nums.end())
        {
            if (*fast != *slow)
            {
                slow++;
                *slow = *fast;
            }
            fast++;
        }
        return slow - nums.begin() + 1;
    }
};